package com.huawei.appgallery.appcomment.widget;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView.LayoutParams;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.List;
import o.azb;
import o.bcg.b;
import o.bcg.d;
import o.epv;
import o.evf;

public class SpinnerAdapter extends ArrayAdapter<String> {
    private boolean isImmer = false;
    private Context mContext;
    private int textColor;

    static class a {
        private TextView ˋ;

        private a() {
        }
    }

    public boolean isImmer() {
        return this.isImmer;
    }

    public void setImmer(boolean z) {
        this.isImmer = z;
    }

    public int getTextColor() {
        return this.textColor;
    }

    public void setTextColor(int i) {
        this.textColor = i;
    }

    public SpinnerAdapter(@NonNull Context context, @NonNull List<String> list) {
        super(context, d.ॱˋ, list);
        this.mContext = context;
    }

    public SpinnerAdapter(@NonNull Context context, @NonNull String[] strArr) {
        super(context, d.ॱˋ, strArr);
        this.mContext = context;
    }

    public View getDropDownView(int i, @Nullable View view, @NonNull ViewGroup viewGroup) {
        String str = (String) getItem(i);
        View inflate = LayoutInflater.from(this.mContext).inflate(d.ˈ, null);
        TextView textView = (TextView) inflate.findViewById(16908308);
        textView.setLayoutParams(new LayoutParams(-1, this.mContext.getResources().getDimensionPixelSize(b.ॱॱ)));
        textView.setText(str);
        return inflate;
    }

    @NonNull
    public View getView(int i, @Nullable View view, @NonNull ViewGroup viewGroup) {
        a aVar;
        String str = (String) getItem(i);
        if (view == null || !(view.getTag() instanceof a)) {
            view = LayoutInflater.from(this.mContext).inflate(d.ॱˋ, null);
            a aVar2 = new a();
            aVar2.ˋ = (TextView) view.findViewById(16908308);
            aVar2.ˋ.setPadding(0, 0, 0, 0);
            view.setTag(aVar2);
            evf.ˋ(aVar2.ˋ, o.bcg.a.ˋ);
            aVar2.ˋ.setMaxWidth((azb.ॱ(this.mContext) - (((azb.ˊ(getContext()) + azb.ˏ(getContext())) + epv.ˋ(getContext(), 16)) + epv.ˋ(getContext(), 32))) / 3);
            aVar = aVar2;
        } else {
            aVar = (a) view.getTag();
        }
        aVar.ˋ.setText(str);
        if (this.isImmer) {
            aVar.ˋ.setTextColor(this.textColor);
        }
        return view;
    }
}
